import {BasicColumn} from '/@/components/Table';
import {FormSchema} from '/@/components/Table';
import { rules} from '/@/utils/helper/validator';
import { render } from '/@/utils/common/renderUtils';
//列表数据
export const columns: BasicColumn[] = [
   {
    title: '用户账号',
    align:"center",
    dataIndex: 'userName'
   },
   {
    title: '任务标题',
    align:"center",
    dataIndex: 'taskTitle'
   },
   {
    title: '科室名称',
    align:"center",
    dataIndex: 'sectionoffice'
   },
   {
    title: '病症名称',
    align:"center",
    dataIndex: 'taskClass'
   },
   {
    title: '患者姓名',
    align:"center",
    dataIndex: 'patientName'
   },
   {
    title: '患者年龄',
    align:"center",
    dataIndex: 'patientAge'
   },
   {
    title: '患者性别',
    align:"center",
    dataIndex: 'patientSex_dictText'
   },
   {
    title: '患病时长',
    align:"center",
    dataIndex: 'illnessTime'
   },
   {
    title: '联系方式',
    align:"center",
    dataIndex: 'phone'
   },
   {
    title: '患者住址',
    align:"center",
    dataIndex: 'patientAddress'
   },
   {
    title: '悬赏金额',
    align:"center",
    dataIndex: 'rewardAmount'
   },
   {
    title: '是否住宿',
    align:"center",
    dataIndex: 'isStay_dictText'
   },
   {
    title: '是否推荐',
    align:"center",
    dataIndex: 'isRecommend_dictText'
   },
   {
    title: '任务浏览量',
    align:"center",
    dataIndex: 'taskViews'
   },
   {
    title: '接单状态',
    align:"center",
    dataIndex: 'receivingStatus_dictText'
   },
   {
    title: '任务描述',
    align:"center",
    dataIndex: 'taskDescribe'
   },
];
//查询数据
export const searchFormSchema: FormSchema[] = [
];
//表单数据
export const formSchema: FormSchema[] = [
  {
    label: '用户账号',
    field: 'userName',
    component: 'JPopup',
    componentProps: ({ formActionType }) => {
        const {setFieldsValue} = formActionType;
        return{
            setFieldsValue:setFieldsValue,
            code:"user",
            fieldConfig: [
                { source: 'id', target: 'userId' },
                { source: 'user_name', target: 'userName' },
            ],
            multi:true
        }
    },

  },
  {
    label: '任务标题',
    field: 'taskTitle',
    component: 'Input',
  },
  {
    label: '科室名称',
    field: 'sectionoffice',
    component: 'JPopup',
    componentProps: ({ formActionType }) => {
        const {setFieldsValue} = formActionType;
        return{
            setFieldsValue:setFieldsValue,
            code:"seconddisease",
            fieldConfig: [
                { source: 'firstdisease_id', target: 'sectionofficeId' },
                { source: 'firstdisease_name', target: 'sectionoffice' },
                { source: 'id', target: 'taskclassId' },
                { source: 'seconddisease_name', target: 'taskClass' },
            ],
            multi:true
        }
    },

  },
  {
    label: '病症名称',
    field: 'taskClass',
    component: 'JPopup',
    componentProps: ({ formActionType }) => {
        const {setFieldsValue} = formActionType;
        return{
            setFieldsValue:setFieldsValue,
            code:"seconddisease",
            fieldConfig: [
                { source: 'firstdisease_id', target: 'sectionofficeId' },
                { source: 'firstdisease_name', target: 'sectionoffice' },
                { source: 'id', target: 'taskclassId' },
                { source: 'seconddisease_name', target: 'taskClass' },
            ],
            multi:true
        }
    },

  },
  {
    label: '患者姓名',
    field: 'patientName',
    component: 'Input',
  },
  {
    label: '患者年龄',
    field: 'patientAge',
    component: 'Input',
  },
  {
    label: '患者性别',
    field: 'patientSex',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"sex"
     },
  },
  {
    label: '患病时长',
    field: 'illnessTime',
    component: 'Input',
  },
  {
    label: '联系方式',
    field: 'phone',
    component: 'Input',
  },
  {
    label: '患者住址',
    field: 'patientAddress',
    component: 'Input',
  },
  {
    label: '悬赏金额',
    field: 'rewardAmount',
    component: 'InputNumber',
  },
  {
    label: '是否住宿',
    field: 'isStay',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"yn"
     },
  },
  {
    label: '是否推荐',
    field: 'isRecommend',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"yn"
     },
  },
  {
    label: '任务浏览量',
    field: 'taskViews',
    component: 'Input',
  },
  {
    label: '接单状态',
    field: 'receivingStatus',
    component: 'JDictSelectTag',
    componentProps:{
        dictCode:"receiving"
     },
  },
  {
    label: '任务描述',
    field: 'taskDescribe',
    component: 'InputTextArea',
  },
	// TODO 主键隐藏字段，目前写死为ID
	{
	  label: '',
	  field: 'id',
	  component: 'Input',
	  show: false
	},
];



/**
* 流程表单调用这个方法获取formSchema
* @param param
*/
export function getBpmFormSchema(_formData): FormSchema[]{
  // 默认和原始表单保持一致 如果流程中配置了权限数据，这里需要单独处理formSchema
  return formSchema;
}